using System;
using System.Collections;
using System.Collections.Generic;
using LitJson;
using UnityEngine;
using UnityEngine.Rendering;
public class DevicedInfo
{
    public string system_software;
    public string device_type;
    public string device_model;
    public string network;
    public string telecom_oper;
    public long memory;
    public long benchmark_level;
    public long game_installed_disk_avail_storage;
    public long game_installed_disk_total_storage;
    public long screen_height;
    public long screen_width;
    public string gl_render;
    public string gl_version;
    public string dpi;
}
public class ReqMajorLoginOrRegi
{
    public string external_id;
    public int external_type;
    public int plat_id;
    public string region;
    public string language;
    public string client_ip;
    public string client_version;
    public DevicedInfo deviced_info;
    static ReqMajorLoginOrRegi a = new ReqMajorLoginOrRegi();
    public static ReqMajorLoginOrRegi Malloc(string openid)
    {
        a.external_id = openid;
        a.external_type = 0;
        a.plat_id = 1;
        a.region = "CN";
        a.language = "zh";
        a.client_version = "8.0.5";
        a.client_ip = "10.10.10.1";
        a.deviced_info = new DevicedInfo();
        a.deviced_info.system_software = "1efefef";
        a.deviced_info.device_type = "1efefef";
        a.deviced_info.device_model = "1efefef";
        a.deviced_info.network = "1efefef";
        a.deviced_info.memory = 1111;
        a.deviced_info.benchmark_level =2222;
        a.deviced_info.screen_width = 3333;
        a.deviced_info.screen_height = 4444;
        var gdt = UnityEngine.SystemInfo.graphicsDeviceType;
        if (gdt == GraphicsDeviceType.OpenGLES3) {
            a.deviced_info.gl_render = "OpenGLES3";
        } else if (gdt == GraphicsDeviceType.OpenGLES2) {
            a.deviced_info.gl_render = "OpenGLES2";
        } else if (gdt == GraphicsDeviceType.OpenGLCore) {
            a.deviced_info.gl_render = "OpenGLCore";
        } else if (gdt == GraphicsDeviceType.Metal) {
            a.deviced_info.gl_render = "iOS Metal";
        } else if (gdt == GraphicsDeviceType.Direct3D12) {
            a.deviced_info.gl_render = "Direct3D 12";
        }
        a.deviced_info.gl_version = UnityEngine.SystemInfo.graphicsDeviceVersion;
        a.deviced_info.dpi = "111";
        a.deviced_info.game_installed_disk_total_storage = UnityEngine.SystemInfo.systemMemorySize;
        return a;
    }
}

public class ResMajorLogin
{
    public int code;
    public string message;
    public string account_id;
    public string lock_region;
    public string noti_region;
    public string ip_region;
    public string token;
    public int ttl;
    public string account_uid;
    public Black black;
    public string[] recommend_regions;

    static ResMajorLogin a = new ResMajorLogin();
    public static ResMajorLogin Malloc()
    {
        a.code = 0;
        a.message = "fest";
        a.account_id = "fest";
        a.lock_region = "fest";
        a.noti_region = "fest";
        a.ip_region = "fest";
        a.token = "fest";
        a.ttl = 4;
        a.black = new Black(){ age = 10, name = "fefef" };
        a.recommend_regions = new string[]{ "21312", "43434" };
        return a;
    }
}
public class ResMajorRegister
{
    public string account_id;
    public string account_uid;
}
public class Black
{
    public int age;
    public string name;
}
public class ResCode
{
    public int code;
    public string message;
    public string open_id;
    public string union_id;
}
public class TestJson : MonoBehaviour
{
    void Start()
    {
        // var reqstr = JsonMapper.ToJson(ReqMajorLoginOrRegi.Malloc("x0001"));
        // var reqstr = JsonMapper.ToJson(ResMajorLogin.Malloc());
        // Debug.Log("请求登录："+reqstr);
        
        var str = "{\"open_id\":\"oJudy7dSEfSGGP7_9j1ILpg57kig\"}";
        var obj = JsonMapper.ToObject<ResCode>(str);
        Debug.Log(obj.open_id);
        
        int hour = DateTime.Now.Hour;
        int minute = DateTime.Now.Minute;
        int second = DateTime.Now.Second;
        Debug.Log(hour + ":" + minute + ":" + second);
        if (hour == 0 && minute == 0 && second <=3) {
            
        }
    }
    void Update() { }
}